package com.experiment06;

import java.util.List;

public class BusinessLogicImpl implements BusinessLogic{
    @Override
    public void overWeight(Ship ship, List<Container> containers) throws MyException {
        double totalWeight = 0;
        for(Container c:containers){
            totalWeight += c.getWeight();
        }
        if(totalWeight > ship.getTotalWeight())
            throw new MyException("超重");
    }
}
